package com.ruoyi.zhjd.laboratory.modules.asphaltSofteningPoint.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.zhjd.laboratory.modules.asphaltSofteningPoint.entity.AsphaltSofteningPointResEntity;
import com.ruoyi.zhjd.laboratory.modules.asphaltSofteningPoint.service.AsphaltSofteningPointResService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;

/**
 * 沥青软化点试验仪_结果表
 *
 * @author sx
 * @email
 * @date 2023-07-11 18:29:54
 */
@RestController
@RequestMapping("laboratory/asphaltSofteningPointRes")
public class AsphaltSofteningPointResController {

    @Autowired
    private AsphaltSofteningPointResService asphaltSofteningPointResService;

    /**
     * 列表
     */
    @RequestMapping("/page")
    //
    public R page(@RequestParam Map<String, Object> params){
        IPage page = asphaltSofteningPointResService.queryPage(params);
        return R.ok(page);
    }


    /**
     * 信息
     */
    @RequestMapping("/find/{id}")
    //
    public R find(@PathVariable("id") String id){
		AsphaltSofteningPointResEntity asphaltSofteningPointRes = asphaltSofteningPointResService.getInfo(id);
        return R.ok(asphaltSofteningPointRes);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //
    public R save(@RequestBody AsphaltSofteningPointResEntity asphaltSofteningPointRes){
		asphaltSofteningPointResService.saveData(asphaltSofteningPointRes);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //
    public R update(@RequestBody AsphaltSofteningPointResEntity asphaltSofteningPointRes){
        asphaltSofteningPointResService.updateData(asphaltSofteningPointRes);
        return R.ok();
    }


    /**
     * 删除单个
     */
    @RequestMapping("/delete/{id}")
    //
    public R deleteOne(@PathVariable("id") String id){
        asphaltSofteningPointResService.deleteOneData(id);
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //
    public R delete(@RequestBody String[] ids){
        asphaltSofteningPointResService.deleteData(Arrays.asList(ids));
        return R.ok();
    }
}
